package Interface;

import javax.swing.JOptionPane;

/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
/**
 *
 * @author Bao Pham
 */
public class MainGUI extends javax.swing.JFrame {

    controller.Controller controller;

    public MainGUI(controller.Controller controller) {
        super("Hanoi Bus Supporter");
        initComponents();
        this.controller = controller;
    }

    /**
     * This method is called from within the constructor to initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is always
     * regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        pnBanner = new javax.swing.JPanel();
        logo = new javax.swing.JLabel();
        Name = new javax.swing.JLabel();
        subName = new javax.swing.JLabel();
        lbBanner = new javax.swing.JLabel();
        mnDisplay = new javax.swing.JPanel();
        lbDisplayName = new javax.swing.JLabel();
        lbDisplayIcon = new javax.swing.JLabel();
        mnBusNo = new javax.swing.JPanel();
        jLabel3 = new javax.swing.JLabel();
        NoMn = new javax.swing.JLabel();
        mnRoute = new javax.swing.JPanel();
        jLabel4 = new javax.swing.JLabel();
        RouteMN = new javax.swing.JLabel();
        mnStreet = new javax.swing.JPanel();
        jLabel5 = new javax.swing.JLabel();
        StreetMN = new javax.swing.JLabel();
        mnLocation = new javax.swing.JPanel();
        jLabel1 = new javax.swing.JLabel();
        LocationMN = new javax.swing.JLabel();
        mnEdit = new javax.swing.JPanel();
        jLabel6 = new javax.swing.JLabel();
        jLabel7 = new javax.swing.JLabel();
        jLabel8 = new javax.swing.JLabel();
        EditMN = new javax.swing.JLabel();
        lbHienthi = new javax.swing.JLabel();
        jLabel2 = new javax.swing.JLabel();

        setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
        setMinimumSize(new java.awt.Dimension(694, 600));
        addMouseMotionListener(new java.awt.event.MouseMotionAdapter() {
            public void mouseMoved(java.awt.event.MouseEvent evt) {
                formMouseMoved(evt);
            }
        });
        getContentPane().setLayout(null);

        pnBanner.setBorder(javax.swing.BorderFactory.createEtchedBorder());
        pnBanner.setLayout(null);

        logo.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Icon/logo.png"))); // NOI18N
        pnBanner.add(logo);
        logo.setBounds(70, 10, 100, 100);

        Name.setFont(new java.awt.Font("Perpetua Titling MT", 1, 24)); // NOI18N
        Name.setForeground(new java.awt.Color(255, 255, 255));
        Name.setText("Hanoi Bus Supporter");
        pnBanner.add(Name);
        Name.setBounds(170, 30, 340, 30);

        subName.setFont(new java.awt.Font("Tahoma", 0, 13)); // NOI18N
        subName.setForeground(new java.awt.Color(255, 255, 255));
        subName.setText("Project Core Java & Sofware Engineering");
        pnBanner.add(subName);
        subName.setBounds(170, 70, 250, 14);

        lbBanner.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Icon/banner_background.jpg"))); // NOI18N
        pnBanner.add(lbBanner);
        lbBanner.setBounds(0, 0, 690, 119);

        getContentPane().add(pnBanner);
        pnBanner.setBounds(0, 0, 690, 120);

        mnDisplay.setBorder(javax.swing.BorderFactory.createEtchedBorder());
        mnDisplay.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mousePressed(java.awt.event.MouseEvent evt) {
                mnDisplayMousePressed(evt);
            }
        });
        mnDisplay.addMouseMotionListener(new java.awt.event.MouseMotionAdapter() {
            public void mouseMoved(java.awt.event.MouseEvent evt) {
                mnDisplayMouseMoved(evt);
            }
        });
        mnDisplay.setLayout(null);

        lbDisplayName.setFont(new java.awt.Font("Tahoma", 1, 18)); // NOI18N
        lbDisplayName.setForeground(new java.awt.Color(255, 255, 255));
        lbDisplayName.setText("Display All Bus");
        mnDisplay.add(lbDisplayName);
        lbDisplayName.setBounds(40, 120, 140, 22);

        lbDisplayIcon.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Icon/displayMN.jpg"))); // NOI18N
        lbDisplayIcon.setText("Display All");
        mnDisplay.add(lbDisplayIcon);
        lbDisplayIcon.setBounds(0, 0, 200, 160);

        getContentPane().add(mnDisplay);
        mnDisplay.setBounds(420, 160, 200, 160);

        mnBusNo.setBorder(javax.swing.BorderFactory.createEtchedBorder());
        mnBusNo.addMouseMotionListener(new java.awt.event.MouseMotionAdapter() {
            public void mouseMoved(java.awt.event.MouseEvent evt) {
                mnBusNoMouseMoved(evt);
            }
        });
        mnBusNo.setLayout(null);

        jLabel3.setFont(new java.awt.Font("Tahoma", 1, 18)); // NOI18N
        jLabel3.setForeground(new java.awt.Color(255, 255, 255));
        jLabel3.setText("Search No.");
        mnBusNo.add(jLabel3);
        jLabel3.setBounds(30, 90, 150, 20);

        NoMn.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Icon/NoMn.jpg"))); // NOI18N
        NoMn.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mousePressed(java.awt.event.MouseEvent evt) {
                NoMnMousePressed(evt);
            }
        });
        NoMn.addMouseMotionListener(new java.awt.event.MouseMotionAdapter() {
            public void mouseMoved(java.awt.event.MouseEvent evt) {
                NoMnMouseMoved(evt);
            }
        });
        mnBusNo.add(NoMn);
        NoMn.setBounds(0, 0, 160, 120);

        getContentPane().add(mnBusNo);
        mnBusNo.setBounds(60, 160, 160, 120);

        mnRoute.setBorder(javax.swing.BorderFactory.createEtchedBorder());
        mnRoute.setLayout(null);

        jLabel4.setFont(new java.awt.Font("Tahoma", 1, 18)); // NOI18N
        jLabel4.setForeground(new java.awt.Color(255, 255, 255));
        jLabel4.setText("Search Route");
        mnRoute.add(jLabel4);
        jLabel4.setBounds(20, 90, 130, 30);

        RouteMN.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Icon/RouteMN.jpg"))); // NOI18N
        RouteMN.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mousePressed(java.awt.event.MouseEvent evt) {
                RouteMNMousePressed(evt);
            }
        });
        RouteMN.addMouseMotionListener(new java.awt.event.MouseMotionAdapter() {
            public void mouseMoved(java.awt.event.MouseEvent evt) {
                RouteMNMouseMoved(evt);
            }
        });
        mnRoute.add(RouteMN);
        RouteMN.setBounds(0, 0, 160, 130);

        getContentPane().add(mnRoute);
        mnRoute.setBounds(60, 300, 160, 130);

        mnStreet.setBorder(javax.swing.BorderFactory.createEtchedBorder());
        mnStreet.setForeground(new java.awt.Color(153, 153, 153));
        mnStreet.setLayout(null);

        jLabel5.setFont(new java.awt.Font("Tahoma", 1, 18)); // NOI18N
        jLabel5.setForeground(new java.awt.Color(255, 255, 255));
        jLabel5.setText("Search Street");
        mnStreet.add(jLabel5);
        jLabel5.setBounds(20, 90, 130, 20);

        StreetMN.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Icon/streetMN.jpg"))); // NOI18N
        StreetMN.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mousePressed(java.awt.event.MouseEvent evt) {
                StreetMNMousePressed(evt);
            }
        });
        StreetMN.addMouseMotionListener(new java.awt.event.MouseMotionAdapter() {
            public void mouseMoved(java.awt.event.MouseEvent evt) {
                StreetMNMouseMoved(evt);
            }
        });
        mnStreet.add(StreetMN);
        StreetMN.setBounds(0, 0, 160, 120);

        getContentPane().add(mnStreet);
        mnStreet.setBounds(240, 160, 160, 120);

        mnLocation.setBorder(javax.swing.BorderFactory.createEtchedBorder());
        mnLocation.setLayout(null);

        jLabel1.setFont(new java.awt.Font("Tahoma", 1, 18)); // NOI18N
        jLabel1.setForeground(new java.awt.Color(255, 255, 255));
        jLabel1.setText("Suggest Bus");
        mnLocation.add(jLabel1);
        jLabel1.setBounds(30, 90, 120, 30);

        LocationMN.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Icon/LocationMN.jpg"))); // NOI18N
        LocationMN.setText("Location");
        LocationMN.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mousePressed(java.awt.event.MouseEvent evt) {
                LocationMNMousePressed(evt);
            }
        });
        LocationMN.addMouseMotionListener(new java.awt.event.MouseMotionAdapter() {
            public void mouseMoved(java.awt.event.MouseEvent evt) {
                LocationMNMouseMoved(evt);
            }
        });
        mnLocation.add(LocationMN);
        LocationMN.setBounds(0, 0, 160, 130);

        getContentPane().add(mnLocation);
        mnLocation.setBounds(240, 300, 160, 130);

        mnEdit.setLayout(null);

        jLabel6.setFont(new java.awt.Font("Tahoma", 1, 18)); // NOI18N
        jLabel6.setForeground(new java.awt.Color(255, 255, 255));
        jLabel6.setText("Add");
        mnEdit.add(jLabel6);
        jLabel6.setBounds(100, 10, 34, 14);

        jLabel7.setFont(new java.awt.Font("Tahoma", 1, 18)); // NOI18N
        jLabel7.setForeground(new java.awt.Color(255, 255, 255));
        jLabel7.setText("Update");
        mnEdit.add(jLabel7);
        jLabel7.setBounds(100, 30, 70, 20);

        jLabel8.setFont(new java.awt.Font("Tahoma", 1, 18)); // NOI18N
        jLabel8.setForeground(new java.awt.Color(255, 255, 255));
        jLabel8.setText("Delete");
        mnEdit.add(jLabel8);
        jLabel8.setBounds(100, 50, 80, 22);

        EditMN.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Icon/EditMN.jpg"))); // NOI18N
        EditMN.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                EditMNMouseClicked(evt);
            }
        });
        EditMN.addMouseMotionListener(new java.awt.event.MouseMotionAdapter() {
            public void mouseMoved(java.awt.event.MouseEvent evt) {
                EditMNMouseMoved(evt);
            }
        });
        mnEdit.add(EditMN);
        EditMN.setBounds(0, 0, 200, 90);

        getContentPane().add(mnEdit);
        mnEdit.setBounds(420, 340, 200, 90);

        lbHienthi.setFont(new java.awt.Font("Tahoma", 1, 14)); // NOI18N
        lbHienthi.setForeground(new java.awt.Color(255, 255, 255));
        getContentPane().add(lbHienthi);
        lbHienthi.setBounds(60, 480, 560, 40);

        jLabel2.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Icon/back.jpg"))); // NOI18N
        getContentPane().add(jLabel2);
        jLabel2.setBounds(0, 119, 690, 450);

        pack();
    }// </editor-fold>//GEN-END:initComponents

    private void mnDisplayMouseMoved(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_mnDisplayMouseMoved
        lbHienthi.setText("Chức năng này liệt kê tất cả các xe buýt hiện có của hệ thống");
        lbDisplayIcon.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Icon/displayMN_clicked.jpg"))); // NOI18N
    }//GEN-LAST:event_mnDisplayMouseMoved

    private void mnBusNoMouseMoved(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_mnBusNoMouseMoved
        lbHienthi.setText("Tìm kiếm xe buýt với số xe");
        NoMn.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Icon/NoMn_clicked.jpg"))); // NOI18N      
    }//GEN-LAST:event_mnBusNoMouseMoved

    private void formMouseMoved(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_formMouseMoved
        lbHienthi.setText("Chào mừng bạn đến với Hanoi Bus Supporter !");
        lbDisplayIcon.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Icon/displayMN.jpg"))); // NOI18N
        NoMn.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Icon/NoMn.jpg"))); // NOI18N
        RouteMN.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Icon/RouteMN.jpg"))); // NOI18N
        StreetMN.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Icon/streetMN.jpg"))); // NOI18N
        LocationMN.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Icon/LocationMN.jpg"))); // NOI18N
        EditMN.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Icon/EditMN.jpg"))); // NOI18N
    }//GEN-LAST:event_formMouseMoved

    private void StreetMNMouseMoved(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_StreetMNMouseMoved
        lbHienthi.setText("Tìm kiếm các xe buýt đi qua một tuyến phố nhất định");
        StreetMN.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Icon/streetMN_clicked.jpg"))); // NOI18N
    }//GEN-LAST:event_StreetMNMouseMoved

    private void RouteMNMouseMoved(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_RouteMNMouseMoved
        lbHienthi.setText("Tìm kiếm xe buýt đi qua một lộ trình định sẵn với điểm đầu và điểm cuối");
        RouteMN.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Icon/RouteMN_clicked.jpg"))); // NOI18N
    }//GEN-LAST:event_RouteMNMouseMoved

    private void LocationMNMouseMoved(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_LocationMNMouseMoved
        lbHienthi.setText("Gợi ý các xe buýt đi qua các địa điểm nổi bật");
        LocationMN.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Icon/LocationMN_clicked.jpg"))); // NOI18N
    }//GEN-LAST:event_LocationMNMouseMoved

    private void EditMNMouseMoved(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_EditMNMouseMoved
        lbHienthi.setText("Thêm - sửa - xóa các thông tin liên quan đến xe buýt");
        EditMN.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Icon/EditMN_clicked.jpg"))); // NOI18N
    }//GEN-LAST:event_EditMNMouseMoved

    private void EditMNMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_EditMNMouseClicked
        JOptionPane.showMessageDialog(this, "Đã chọn chức năng êdit");
    }//GEN-LAST:event_EditMNMouseClicked

    private void NoMnMouseMoved(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_NoMnMouseMoved
        lbHienthi.setText("Tìm kiếm xe buýt với số xe");
        NoMn.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Icon/NoMn_clicked.jpg"))); // NOI18N      
    }//GEN-LAST:event_NoMnMouseMoved

    private void NoMnMousePressed(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_NoMnMousePressed
        controller.handleEvent("Search Number");
    }//GEN-LAST:event_NoMnMousePressed

    private void StreetMNMousePressed(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_StreetMNMousePressed
        controller.handleEvent("Search Name");
    }//GEN-LAST:event_StreetMNMousePressed

    private void RouteMNMousePressed(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_RouteMNMousePressed
        controller.handleEvent("SearchByStartEnd");
    }//GEN-LAST:event_RouteMNMousePressed

    private void LocationMNMousePressed(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_LocationMNMousePressed
        controller.handleEvent("SearchFamous");
    }//GEN-LAST:event_LocationMNMousePressed

    private void mnDisplayMousePressed(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_mnDisplayMousePressed
        controller.handleEvent("ListAll");
    }//GEN-LAST:event_mnDisplayMousePressed

    /**
     * @param args the command line arguments
     */
    public static void main(String args[]) {
        /* Set the Nimbus look and feel */
        //<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
        /* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
         * For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html 
         */
        try {
            for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
                if ("Windows".equals(info.getName())) {
                    javax.swing.UIManager.setLookAndFeel(info.getClassName());
                    break;
                }
            }
        } catch (ClassNotFoundException ex) {
            java.util.logging.Logger.getLogger(MainGUI.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (InstantiationException ex) {
            java.util.logging.Logger.getLogger(MainGUI.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (IllegalAccessException ex) {
            java.util.logging.Logger.getLogger(MainGUI.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (javax.swing.UnsupportedLookAndFeelException ex) {
            java.util.logging.Logger.getLogger(MainGUI.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        }
        //</editor-fold>

    }
    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JLabel EditMN;
    private javax.swing.JLabel LocationMN;
    private javax.swing.JLabel Name;
    private javax.swing.JLabel NoMn;
    private javax.swing.JLabel RouteMN;
    private javax.swing.JLabel StreetMN;
    private javax.swing.JLabel jLabel1;
    private javax.swing.JLabel jLabel2;
    private javax.swing.JLabel jLabel3;
    private javax.swing.JLabel jLabel4;
    private javax.swing.JLabel jLabel5;
    private javax.swing.JLabel jLabel6;
    private javax.swing.JLabel jLabel7;
    private javax.swing.JLabel jLabel8;
    private javax.swing.JLabel lbBanner;
    private javax.swing.JLabel lbDisplayIcon;
    private javax.swing.JLabel lbDisplayName;
    private javax.swing.JLabel lbHienthi;
    private javax.swing.JLabel logo;
    private javax.swing.JPanel mnBusNo;
    private javax.swing.JPanel mnDisplay;
    private javax.swing.JPanel mnEdit;
    private javax.swing.JPanel mnLocation;
    private javax.swing.JPanel mnRoute;
    private javax.swing.JPanel mnStreet;
    private javax.swing.JPanel pnBanner;
    private javax.swing.JLabel subName;
    // End of variables declaration//GEN-END:variables
}
